package com.info.zhiduoduo.repository.mapper.system;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.info.zhiduoduo.repository.entity.system.ProjectTemplate;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author TerryJ
 * @since 2018-12-08
 */
public interface ProjectTempalteMapper extends BaseMapper<ProjectTemplate> {

	@Select(" select pt.*,pc.projectcategory from zdd_project_template pt " +
			" join zdd_system_projectcategory pc on pc.projectcategoryid = pt.categoryid and pc.deleted = 0 " +
			" where if(#{categoryid}=0, 1=1, pt.categoryid = #{categoryid}) " +
			" and concat(pc.projectcategory,pt.projectname) like '%${name}%'" +
			" and pt.deleted = 0 order by pc.projectcategory asc ")
	List<ProjectTemplate> getTemplateList(@Param("categoryid") int categoryid, @Param("name") String name);
}
